package com.example.ldxstc.english_master;

import android.app.Fragment;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.text.style.ImageSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * Created on 10/18/14.
 */
public class PracticeFragment extends Fragment {

  private static String TAG = PracticeFragment.class.getSimpleName();

  private static PracticeView practiceView;

  private static String sample_text = "Now, as you might imagine, I wasn't too happy about getting "
      + "up that early. And a lot of times, I'd fall asleep right there at the kitchen table. But "
      + "whenever I'd complain, my mother would just give me one of those looks and she'd say, This"
      + " is no picnic for me either, buster. So I know that some of you are still adjusting to " +
      "being back at school. But I'm here today because I have something important to discuss " +
      "with you. I'm here because I want to talk with you about your education and what's expected" +
      " of all of you in this new school year. I've talked a lot about your government's " +
      "responsibility for setting high standards, and supporting teachers and principals, and " +
      "turning around schools that aren't working, where students aren't getting the opportunities " +
      "that they deserve. \n" +
      "\n" +
      "But at the end of the day, we can have the most dedicated teachers, the most supportive " +
      "parents, the best schools in the world -- and none of it will make a difference, none of " +
      "it will matter unless all of you fulfill your responsibilities, unless you show up to " +
      "those schools, unless you pay attention to those teachers, unless you listen to your" +
      " parents and grandparents and other adults and put in the hard work it takes to succeed." +
      " That's what I want to focus on today: the responsibility each of you has for your" +
      " education. \n" +
      "\n" +
      "I want to start with the responsibility you have to yourself. Every single one of " +
      "you has something that you're good at. Every single one of you has something to offer. " +
      "And you have a responsibility to yourself to discover what that is. That's the opportunity" +
      " an education can provide. ";

  @Override
  public View onCreateView (LayoutInflater inflater, ViewGroup container,
                            Bundle savedInstanceState) {

    Log.i(TAG, "onCreateView");
    View rootView = inflater.inflate(R.layout.fragment_practice, container, false);
    RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.fragment_practice, container, false);

    PracticeView practiceView = (PracticeView) rootView.findViewById(R.id.practice_text);
    practiceView.setText(sample_text);
    practiceView.setMovementMethod(new ScrollingMovementMethod());
    practiceView.initiateCursor();
    return rootView;
  }
}
